home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1998 September
/
Macworld (1998-09).dmg
/
Shareware World
/
Info
/
For Developers
/
Chipmunk_Basic_3.5.5
/
sieve.bas
< prev
next >
Wrap
BASIC Source File
|
1996-07-27
|
432b
|
22 lines
10 rem sieve 6/1/92 test
20 loops = 1
30 t = timer
40 dim f(8194)
50 for j = 1 to loops
60 c = 0
70 s = 8191
80 for i = 0 to s : f(i) = 1 : next i
90 for i = 0 to s
100 if f(i) = 0 then goto 140
110 p = i+i+3
115 if i+p > s then 130
120 for k = i+p to s step p : f(k) = 0 : next k
130 c = c+1
140 next i
150 next j
160 print c;" primes found ";
170 t = timer-t
180 print loops;" times in ";
190 print t;" seconds"
200 end